#!/bin/sh
#
# Author ： hbaolong@vip.qq.com
#
# Function : 这是一个模板
#
#
#

localdir="/Users/hbaolong/workshop/gitee/3place/"

dictfile="ENMYDICT/myendict.md"


if [ $# -lt 1 ]; then
	echo "Usage: $0 words."
	exit
fi

for word in $@
do

	# 检索本地字典

	if grep -q "#### "$word" "  $localdir$dictfile; then
		exit 0
	fi

	# 检索网络字典

	yd $word | sed -e "s/.*\[1G//g" |sed -e "/^$/d" >tmp.md

	if file tmp.md |grep -q empty; then
		echo "这不是单词:" $word
		exit -1
	else
		exit 0
	fi
	rm -f tmp.md
done

